package book;

public class BookList {
    private Book[] books = new Book[10];
    private int size;   //记录存放了多少书

    public BookList(){
        //初始化就存放3本书
        this.books[0] = new Book("三国演义","罗贯中",10,"小说");
        this.books[1] = new Book("西游记","吴承恩",9,"小说");
        this.books[2] = new Book("红楼梦","曹雪芹",19,"小说");
        this.size = 3;
    }

    public Book[] getBooks() {
        return books;
    }

    public void setBooks(Book[] books) {
        this.books = books;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }
    public Book getBook(int i){
        return books[i];
    }
    public void setBook(int pos,Book book){
        this.books[pos] = book;
    }
    public boolean isFull(){
        if(this.size == books.length){
            return true;
        }else{
            return false;
        }
    }
    public void addBook(int newSize,Book newBook){
        this.books[newSize] =  newBook;
    }
}
